<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" title="Default" href="main.css" type="text/css" />
</head>

<body>
<h2 align="center">Rules Management</h2>
<hr/>
<?
	my $q = "SELECT DISTINCT(rv.ruleset_id), rs.name FROM rule_sets rs RIGHT JOIN rule_values rv ON (rv.ruleset_id = rs.ruleset_id) ORDER BY rv.ruleset_id ASC";
	my $res = $EQDB->query($q);
	if ($res) {
		print "<table align=\"center\" border=\"1\" cellspacing=\"2\" cellpadding=\"3\" class=\"zonelist\">\n";
		print "\t<tr>\n";
		print "\t\t<th width=1 nowrap>Name</th>\n";
		print "\t\t<th width=1 nowrap>ID</th>\n";
		print "\t\t<th width=1 nowrap>Rules</th>\n";
		#print "\t\t<th width=1 nowrap></th>\n";	#delete column
		print "\t</tr>\n";
		while (my $row = $res->fetch_row_hash) {
			print "\t<tr>\n";
			print "\t\t<td><a href=\"rules.html?ruleset_id=$row->{ruleset_id}\">$row->{name}</a></td>\n";
			print "\t\t<td><a href=\"rules.html?ruleset_id=$row->{ruleset_id}\">$row->{ruleset_id}</a></td>\n";
			
			my $q2 = "SELECT COUNT(ruleset_id) AS num_rules FROM rule_values WHERE ruleset_id = '$row->{ruleset_id}'";
			my $res2 = $EQDB->query($q2);
			my $row2 = $res2->fetch_row_hash;
			
			print "\t\t<td>$row2->{num_rules}</td>\n";
			#print "\t\t<td><input type=\"image\" src=\"delete.gif\" alt=\"Delete\"></td>\n";
			print "\t</tr>\n";
		}
	} else {
		print "No rule sets";
	}
?>

Todo: show active rule set, change active rule set
</body>
</html>
